﻿using System;
using System.Collections;
using System.Collections.Generic;
using Assets.Scripts.Handlers;
using ExitGames.Client.Photon;
using UnityEngine;
using WorldOfSuperpowers_COMMON;

public class MatchHandler : BaseHandler
{
    
    public override void Response(OperationResponse operationResponse)
    {
        print(code+"收到消息1");
        if (operationResponse.ReturnCode == (byte)ReturnCode.Success)
        {
            print(code + "收到消息2");
            Dictionary<byte, object> pathContent = operationResponse.Parameters;
            object Vcontent = new  object();
            bool hasGet = pathContent.TryGetValue((byte) code, out Vcontent);
            //判断是匹配中的哪一个消息、
            if (hasGet)
            {
                print(code + "收到消息3");
                OperationCode Mcode = (OperationCode) Vcontent;
                switch (Mcode)
                {
                    case OperationCode.ReadyInMatchQueue:
                        MatchManager._instance.ChangeMatchStatus(0);
                        break;
                    case OperationCode.DivideMatch:
                        print(code + "收到消息4");
                        MatchManager._instance.ChangeMatchStatus(1);
                        break;
                }
            }
        }
    }
}
